package xin.infinite.web;


import xin.infinite.vo.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.time.LocalDateTime;

@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {


    @ExceptionHandler(RuntimeException.class)
    public JsonResult doHandleException(RuntimeException e){
        log.error(LocalDateTime.now().toString()+":"+e.getMessage());
        return JsonResult.fail(e);
    }
}
